/*
	This script will autoresize  any div with 'AutoResize' class
*/
(function($) {
		function cleanString (str) {
			return str.replace( /[^\d]/g, "");
        }
		
		function getHeight(e){
		
			var heightStr = e.css("height");
			heightStr=cleanString(heightStr);
			var height = Math.floor(Number(heightStr));
			return height;
		}
		function setHeight(e,height){
			//alert(height);
			e.css("height",height);
		}
				
		function resize(){
			var height = 0;
			if(window.innerHeight)
				height = window.innerHeight;
			else if(document.all)
				height = document.body.clientHeight-15;
			
			$('.AutoResize').each(function(){
				
				$this = $(this);
				var o = $.metadata ? $.extend({}, {wAdjust:0,hAdjust:0}, $this.metadata()) : {wAdjust:0,hAdjust:0};
				//alert("before"+$this.css("height"));
				$this.css("height",height-o.hAdjust);
				//alert("after"+$this.css("height"));
			});			
		}
	$(document).ready( function() {
		// do initial resize
		resize();
		
		// Add call back for the main window is resized
		$(window).resize(function(){
			resize();
		});
	});
// end of closure
})(jQuery);